<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>部署模型服务</title>
    <link rel="stylesheet" href="/css/main1.css">
    <link rel="stylesheet" href="/css/bootstrap.css">
    <link rel="stylesheet" media="screen" href="/css/deployModel.css" />
    <link href="/css/uploadfile.css" rel="stylesheet">
    <script src="/js/jquery.js" type="text/javascript"></script>
    <script src="/js/bootstrap.js"></script>
    <script src="/js/jquery.uploadfile.js" type="text/javascript"></script>
    <script src="/js/deployModel.js" type="text/javascript" ></script>
    <script src="/js/deployModel2.js" type="text/javascript" ></script>
    <link rel="stylesheet" href="/css/deployModel2.css">

    <script type="text/javascript">
        var path = '<%= path %>';
        $(document).ready(function(){
            var upload = $("#fileuploader").uploadFile({
                //上传路径
                url:"/modelser/space/upload/",
                //上传文件名
                fileName:"myfile",
                //是否多个文件
                multiple:true,
                //是否拖拽上传
                dragDrop:true,
                //最大文件数
                maxFileCount:5,
                //规定上传文件格式
                acceptFiles:"*/*",
                //最大文件大小
                maxFileSize:100*1024*1024,
                //表单数据
                formData:
                {
                    path:"<%= path %>"
                },
                //上传文件按钮文本
                uploadStr:"上传文件",
                //取消上传按钮文本
                cancelStr:"取消文件",
                //拖拽上传提示文本（带HTML）
                dragDropStr:"<span><b>拖拽上传</b></span>",
                //完成上传提示文本
                doneStr:"完成上传",
                //是否自动传
                autoSubmit:false,
                //是否显示已上传文件
                showDownload:false,
                //上传完成后
                afterUploadAll:function(obj)
                {
                    location.reload();
                }
            });

            $("#extrabutton").click(function()
            {
                upload.startUpload();
            });

            $('#newdir').click(function()
            {
                var dirname = prompt("请输入文件夹名称:");
                $.ajax({
                    url:'/modelser/space/newdir?path=' + path + '&name=' + dirname,
                    success:function(data)
                    {
                        window.location.reload();
                    }
                });
            });
        });

        function setStart(name)
        {
            $.ajax({
                url:'/modelser/starting/'+ '<%= msid %>' + '?path=' + path + '&name=' + name,
                method:'PUT',
                success:function(data)
                {
                    alert(data);
                }
            });
        }
    </script>

</head>
<body>

<header id="header">
    <nav class="navbar navbar-inverse" role="banner">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="index.html">分布式地理建模 </a>
            </div>
            <div class="collapse navbar-collapse navbar-right">
                <ul class="nav navbar-nav">
                    <li><a href="index.html"><strong>主页</strong></a></li>
                    <li>
                        <a class="dropdown-toggle" data-toggle="dropdown"
                           href="#"><strong>联系我们</strong>&nbsp;<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">挖，真帅</a></li>
                            <li class="divider"></li>
                            <li><a href="#">挖，真帅</a></li>
                        </ul>
                    </li>

                    <li>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#"><strong>共享环境</strong>&nbsp;<span
                                    class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">挖，真帅</a></li>
                            <li class="divider"></li>
                            <li><a href="#">挖，真帅</a></li>
                        </ul>
                    </li>
                    <li class="active"><a href="#"><strong>查看模型</strong></a></li>
                    <li><a href="uploadModel.html"><strong>上传模型</strong></a></li>
                    <li><a href="#"><strong>联系我们</strong></a></li>
                </ul>
            </div>
        </div>
    </nav>
</header>
<!--end 导航条-->

<!--start 主体body-->
<div class="container">
    <div class="title">部署模型服务网盘信息</div>
    <div id="msform">
        <fieldset>
            <div id="divTable">
                <table class="table" >
                    <thead>
                    <th></th>
                    <th>文件名</th>
                    <th>大小</th>
                    <th>更新时间</th>
                    <th>操作</th>
                    </thead>
                    <tbody >
                    <% if(parent != null)
                    {
                    %><tr >
                        <td></td>
                        <td onclick="window.location.href = '<%= parent %>'">
                            <a>...</a>
                        </td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr><%
                    }%>
                    <% filesData.forEach(function(item)
                    {
                            if(item.type == 'dir')
                    {
                    %><tr >
                        <td></td>
                        <td title="<%= item.name %>" onclick="window.location.href = window.location.href + '/<%= item.name %>'">
                            <a><img src="/images/f01.png" />&nbsp;&nbsp; <%=item.name.length > 12  ?  item.name.substring(0,12) + '...' : item.name %> </a>
                        </td>
                        <td></td>
                        <td><%= item.update %></td>
                        <td></td>
                    </tr><%
                    }
                    });
                            filesData.forEach(function(item)
                    {
                            if(item.type == 'file')
                    {
                    %><tr >
                        <td></td>
                        <td><a><img src="/images/f03.png" />&nbsp;&nbsp; <%=item.name.length > 12  ?  item.name.substring(0,12) + '...' : item.name %> </a></td>
                        <td><%
                            if(item.size > 1048576)
                            {
                            %><%= (item.size / 1048576).toFixed(2) %> MB<%
                            }
                            else if(item.size < 1024)
                            {
                            %> < 1 KB<%
                            }
                            else
                            {
                            %><%= (item.size / 1024).toFixed(2) %> KB<%
                            }%></td>
                        <td><%=  item.update %></td>
                        <td>
                            <button class="btn btn-sm btn-primary" onclick="setStart('<%= item.name %>')" ><span class="glyphicon glyphicon-wrench">设为启动项</span></button>
                            <button class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove">删除</span></button>
                        </td>
                    </tr><%
                    }
                    });
                    %>
                    </tbody>
                </table>
                <div id="fileuploader">Upload</div>
                <div class="divBtn">
                    <input id="extrabutton" style="display: inline;width:30%;" type="button" value="开始上传" />
                    <input id="newdir" style="display:inline;width:30%" type="button" value="新建文件夹" />
                </div>
            </div>

            <hr>
            <input type="button" id="btnPrevious1" name="previous" class="previous action-button" value="上一步" />
            <input type="button" id="btnNext2" name="next" class="next action-button" value="下一步" />
        </fieldset>
    </div>

    <!-- <script src="js/jquery.easing.1.3.js" type="text/javascript"></script> -->
    <script src="/js/deployModel.js" type="text/javascript"></script>

</div><!-- // container end -->
<!--end 主体body-->

<hr/>

<!--start 友情链接-->
<div id="footer1">
    <div class="container" style="height:200px;">
        <div class="row">
            <div class="col-sm-3">
                <ul class="faddress">
                    <li><img style="height:70px;" src="/images/nsIcon.png" alt=""/></li>
                    <li><i class="fa fa-map-marker fa-lg"></i>&nbsp; 南京市栖霞区文苑路1号</li>
                    <li><i class="fa fa-phone"></i>&nbsp; 025-123456789</li>
                    <li><i class="fa fa-print"></i>&nbsp; 025-123456789</li>
                    <li><a href="mailto:info@yourdomain.com"><i class="fa fa-envelope"></i>&nbsp;modeling@qq.com</a>
                    </li>
                </ul>
            </div><!-- end address -->

            <div class="col-sm-3">
                <div class="qlinks">
                    <h3 class="lmb nocaps">资源通道</h3>
                    <ul>
                        <li><a href="#"><i class="fa fa-angle-right"></i> 地理图标库</a></li>
                        <li><a href="#"><i class="fa fa-angle-right"></i> 数据交换接口库</a></li>
                        <li><a href="#"><i class="fa fa-angle-right"></i> 地理概念库</a></li>
                        <li><a href="#"><i class="fa fa-angle-right"></i> 单位/量纲库</a></li>
                        <li><a href="#"><i class="fa fa-angle-right"></i> 随便什么玩意</a></li>
                    </ul>
                </div>
            </div><!-- end links -->

            <div class="col-sm-3">
                <div class="frposts">
                    <h3 class="lmb nocaps">友情链接</h3>
                    <ul>
                        <li><a href="#"><i class="fa fa-caret-right"></i> 南京师范大学</a></li>
                        <li><a href="#"><i class="fa fa-caret-right"></i> 北京大学</a></li>
                        <li><a href="#"><i class="fa fa-caret-right"></i> 中国科学院寒旱区研究所</a></li>
                        <li><a href="#"><i class="fa fa-caret-right"></i> 国家自然科学基金委员会</a></li>
                        <li><a href="#"><i class="fa fa-caret-right"></i> 大滁州学院</a></li>
                    </ul>
                </div>
            </div><!-- end links -->

            <div class="col-sm-3">
                <div class="siteinfo">

                    <h3 class="lmb nocaps">关于我们</h3>

                    <p>我们是最牛逼的，们是最牛逼的，是最牛逼的，最牛逼的，牛逼的，逼的，的.</p>
                    <br/>
                    <a href="#">获取更多 <i class="fa fa-long-arrow-right"></i></a>

                </div>
            </div><!-- end site info -->
        </div>
    </div>
</div>
<!-- end 友情链接 -->

<!--start footer-->
<footer id="footer">
    <div class="container">
        <div class="row">
            <div class="col-sm-6">Copyright &copy; 2015 强大的505实验室.--我就问你怕不怕</div>
            <div class="col-sm-6">
                <div class="follow-us"><a class="fa fa-facebook social-icon" href="#"></a> <a
                            class="fa fa-twitter social-icon" href="#"></a> <a class="fa fa-linkedin social-icon"
                                                                               href="#"></a> <a
                            class="fa fa-google-plus social-icon" href="#"></a></div>
            </div>
        </div>
    </div>
</footer>
<!-- end footer-->
</body>
</html>